﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Text;
using PublicLib.Lib.Help;
using System.Diagnostics;

namespace WebServerHntj
{
    // 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码、svc 和配置文件中的类名“TestService”。
    // 注意: 为了启动 WCF 测试客户端以测试此服务，请在解决方案资源管理器中选择 TestService.svc 或 TestService.svc.cs，然后开始调试。

    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class TestService : ITestService
    {
        public Stream TestGet()
        {
            Debug.WriteLine(DateTime.Now.ToString() + " Test:TestGet");
            return "TestGet successful".ToStream();
        }

        public Stream TestGetWithParam(string param)
        {
            Debug.WriteLine(DateTime.Now.ToString() + " Test:TestGetWithParam");
            return ("TestGet successful. Param is " + param).ToStream();
        }

        public Stream TestPost(Stream inputStream)
        {
            Debug.WriteLine(DateTime.Now.ToString() + " Test:TestPost");
            return ("TestPost successful. PostData is " + inputStream.ToString(true)).ToStream();
        }

        public Stream TestPostWithParam(string param, Stream inputStream)
        {
            Debug.WriteLine(DateTime.Now.ToString() + " Test:TestPostWithParam");
            return ("TestPost successful. Param is " + param + " PostData is " + inputStream.ToString(true)).ToStream();
        }
    }
}
